var username=GetParentQueryString("username");
var userid;
layui.config({
    version:'1510164124181'
}).use(['form', 'laypage', 'layer', 'element'],function(){
    form = layui.form;
    layer = layui.layer;
    $ = layui.jquery;
    laypage = layui.laypage;//分页
    element = layui.element; //元素操作
    SelectRoleList();
    SelectUserList();
});

function SelectUserList() {
    let roleid=$("#RoleList option:selected").val();
    $.ajax({
        url: httpurl + "/SelectUserList",
        headers: {
            "Access-Control-Allow-Origin": "*",
            "Access-Control-Allow-Methods": "*",
            "Access-Control-Allow-Headers": "Authorization",
            "Authorization": GetTokenInfo()
        },
        contentType : 'application/json',
        cache: false,
        data:{
            "page":pageNo,
            "pagesize":pageSize,
            "roleid":roleid,
        },
        success: function (data) {
            let info="";
            if(data.rtnCode==200){
                let dataInfo=data.data.list;
                totalRecords = data.data.total;
                for(let i=0;i<dataInfo.length;i++) {
                    info += '<tr>' +
                        '<td><input type="checkbox"  name="box" class="aceChild"/></td>' +
                        '<td>' + dataInfo[i].username + '</td>' +
                        '<td>' + dataInfo[i].role.roleName + '</td>' +
                        '<td>' + (!isNotNull(dataInfo[i].createDate)?"无":dataInfo[i].createDate) + '</td>' +
                        '<td>' + (!isNotNull(dataInfo[i].lastLoginTime)?"无":dataInfo[i].lastLoginTime) + '</td>' +
                        '<td>' +
                        '<a href="AddUser.html?UserId='+dataInfo[i].id+'">查看</a>&nbsp;&nbsp;&nbsp;' +
                        '<a href="#" data-id="'+dataInfo[i].id+'" data-info="deleteUser" onclick="DeleteInfo(this);">删除</a>' +
                        '</td>' +
                        '</tr>';
                }
            }else{
                info += '<tr>'
                    +'<td colspan="8" style="text-align:center;">暂无数据</td>'
                    +'</tr>';
            }
            $("#TableInfo tbody").html(info);
            pageLayPage("SelectUserList");
        }
    })
};

function SearchInfo() {
    pageNo=1;
    SelectUserList();
}

